import request from '../../router/axios'

export const uploadPhoto = data => { // 上传头像
  return request({
    url: '/admin/user/personal/upload/photo',
    method: 'post',
    data,
  })
}
export const getUserInfo =() => { // 获取登录人信息
  return request({
    url: '/admin/user/personal/info',
    method: 'get',
  })
}
export const changeUserInfo =data => { // 修改登录人信息
  return request({
    url: '/admin/user/personal/info',
    method: 'put',
    data,
  })
}
export const pushCode =data => { // 发送邮箱验证码
  return request({
    url: '/admin/user/personal/email/sendCode',
    method: 'post',
    data,
  })
}
export const changeEmail =data => { // 更改邮箱
  return request({
    url: '/admin/user/personal/email',
    method: 'put',
    data
  })
}
export const changeEmailspare =data => { // 更改备用邮箱
  return request({
    url: '/admin/user/personal/emailspare',
    method: 'put',
    data
  })
}
export const relieveEmail =data => { // 解绑邮箱
  return request({
    url: '/admin/user/personal/email/unbundling',
    method: 'POST',
    data
  })
}

export const changePassword =data => { // 更改密码
  return request({
    url: '/admin/user/personal/password',
    method: 'put',
    data
  })
}
export const getCountryInfo =() => { // 获取国家数据
  return request({
    url: '/admin/region/country',
    method: 'get',
  })
}
export const getProvinceInfo =() => { // 获取省数据
  return request({
    url: '/admin/region/province',
    method: 'get',
  })
}
export const getCityInfo =data => { // 获取城市数据
  return request({
    url: '/admin/region/city',
    method: 'get',
    params:data,
  })
}

// 常用语
export const addCommonexpression =data => { // 新增
  return request({
    url: '/admin/commonexpression',
    method: 'post',
    data,
  })
}
export const editCommonexpression =data => { // 修改
  return request({
    url: '/admin/commonexpression',
    method: 'put',
    data,
  })
}
export const checkCommonexpressionList =data => { // 分页查询
  return request({
    url: '/admin/commonexpression/page',
    method: 'get',
    params:data,
  })
}
export const idCheckCommonexpression =data => { // id查询
  return request({
    url: '/admin/commonexpression',
    method: 'get',
    params:data,
  })
}
export const idEnable =data => { // id启用
  return request({
    url: `/admin/commonexpression/enable/${data}`,
    method: 'post',
  })
}
export const idDisable =data => { // id禁用
  return request({
    url: `/admin/commonexpression/disable/${data}`,
    method: 'post',
  })
}
export const getCommonexpressionType =() => { // 获取类型
  return request({
    url: '/admin/commonconfig/commonexpressiontype/list',
    method: 'get',
  })
}
export const creatQrcode=(data) => { // 生成签名二维码
  return request({
    url: '/admin/usersignature/qrcode',
    method: 'get',
    params:data
  })
}
export const getUserSign=() => { // 获取当前用户签名
  return request({
    url: '/admin/usersignature/loggeduser',
    method: 'get',
  })
}
export const postPassword=(data) => { // 设置签名密码
  return request({
    url: '/admin/usersignature/password/add',
    method: 'POST',
    data
  })
}
export const updatePassword=(data) => { // 设置签名密码
  return request({
    url: '/admin/usersignature/password/update',
    method: 'POST',
    data
  })
}

export const tableOption=(that)=>{
  return {
     // title:'表格的标题',
    // menuType:'text',
    searchBtn:false,
    index:true,
    indexLabel:'序号',
    page:true,
    align:'center',
    dateBtn:false,
    delBtn:false,
    addBtn:false,
    editBtn:false,
    columnBtn:false,
    refreshBtn:false,
    dateDefault:false,
    menuWidth:160,
    header:false,
    border:true,
    // menuAlign:'center',
    column:[
      {
        label:'主题',
        prop:'content'
      },{
        label:'类型',
        prop:'typeName'
      },{
        label: "最近修改日期",
        prop: "createTime",
      }
    ]
  }
}